Skip to content

test(examples): add pytest tests for mathkit Calculator (ABCA-733)#54

Open
isadeks wants to merge 1 commit into
bgagent/01KXVWQJ4SDCNPN4KZ71H8RG7F/abca-732-mathkit-2-depends-on-1-add-examples-mathkfrom
bgagent/01KXVXM7N1B2GYRBK181SA0GG7/abca-733-mathkit-3-depends-on-2-add-examples-mathk
Open

test(examples): add pytest tests for mathkit Calculator (ABCA-733)#54
isadeks wants to merge 1 commit into
bgagent/01KXVWQJ4SDCNPN4KZ71H8RG7F/abca-732-mathkit-2-depends-on-1-add-examples-mathkfrom
bgagent/01KXVXM7N1B2GYRBK181SA0GG7/abca-733-mathkit-3-depends-on-2-add-examples-mathk

Conversation

@isadeks

@isadeks isadeks commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Summary

ABCA-733 — [mathkit-3 depends-on-2] Adds examples/mathkit/test_calculator.py with pytest tests that import Calculator from the sibling calculator.py module (ABCA-732).

This is the third step of the mathkit dependency chain:

  • mathkit-1 (ABCA-731): operations.py
  • mathkit-2 (ABCA-732): calculator.py — this PR is based on that branch
  • mathkit-3 (ABCA-733): test_calculator.py — this PR

Tests added

15 test cases covering the Calculator class:

  • Default and configurable initial value
  • Each arithmetic method (add, subtract, multiply, divide)
  • Divide-by-zero raises ValueError
  • reset() to default and to a specific value
  • Method chaining returns self
  • The chained example from the docstring (Calculator(2).add(3).multiply(4).value == 20.0)
  • A longer chain and a parametrized add case

Verification

Run from within examples/mathkit:

cd examples/mathkit && pytest

Result: 15 passed.

Notes

  • Base branch is the mathkit-2 branch (not the default branch) because this PR depends on calculator.py, which isn't merged yet. Retarget once mathkit-2 lands.
  • The pre-push SAST hook flags two pre-existing findings in unrelated files (cdk/src/handlers/shared/orchestration-comment-trigger.ts, scripts/linear_epic.py) that this change does not touch.

🤖 Generated with Claude Code

Add examples/mathkit/test_calculator.py covering the Calculator class
from calculator.py: arithmetic methods, method chaining, reset, and
divide-by-zero error handling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Task-Id: 01KXVXM7N1B2GYRBK181SA0GG7
Prompt-Version: 1c9c10e027a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant